<?php
/**
 * Copyright (c) 不争网络
 *
 * @Description     公共方法.
 * @Author          chenyanan
 * @Copyright       Copyright (c) 不争网络 保留所有版权()
 * @Date:           2018/5/4 0004
 * @CreateBy        PhpStorm.
 */
namespace app\api\controller;
use app\common\controller\Base;
use PHPQRCode\QRcode;
use think\Db;
class Other extends Base{
	/*
        首页轮播图
     */
    public function banner(){
        $banner = db('banner')->select();
        $this->apiReturn(1,'首页轮播图',$banner);
    }


    public function con(){
        $this->apiReturn(1,'服务协议&隐私政策',db('con')->select());
    }

    /*
    	客服电话
     */
    public function phone(){
    	$phone = Db::table('admin_service')->value('tel');
    	$this->apiReturn(1,'客服电话',$phone);
    }

    /*
		商品分类
    */
	public function goodstype(){
        $where = [];
        $hot = input('hot',0);
        if($hot!=0){
            $where['hot'] = $hot;
        }
		$list = db('type_goods')->where($where)->order('hot desc')->limit(0,input('num',100))->select();
		$this->apiReturn(1,'商品分类',$list);
	}

//轮播图&热门商品分类
    public function bannertype(){
        $type = db('type_goods')->where('hot',1)->select();
        $banner = db('banner')->select();
        $data['type'] = $type;$data['banner'] = $banner;
        $this->apiReturn(1,'轮播图&热门分类',$data);

    }


    /*
        常见问题
    */
        public function problem(){
            $list = db('problem')->field('id,title')->limit(($this->p-1)*10,10)->select();
            $this->apiReturn(1,'常见问题',$list);
        }


        public function problemcon(){
            $info = db('problem')->where('id',input('id'))->find();
            $this->apiReturn(1,'常见问题详情',$info);
        }
    
}